<html><head>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8"><title>NetworkClient.pb</title></head>
<body bgcolor="#FFFFDF" link="#009999" vlink="#006666" alink="#006666">
<pre><font face="Courier New, Courier, mono"size="2"><font color="#006666">;
</font><font color="#006666">; ------------------------------------------------------------
</font><font color="#006666">;
</font><font color="#006666">;   PureBasic - Network (Client) example file
</font><font color="#006666">;
</font><font color="#006666">;    (c) Fantaisie Software
</font><font color="#006666">;
</font><font color="#006666">; ------------------------------------------------------------
</font><font color="#006666">;
</font>
<b><font color="#006666">If</font></b> <font color="#006666">InitNetwork</font>() = 0
<font color="#006666">  MessageRequester</font>("Error", "Can't initialize the network !", 0)
  <b><font color="#006666">End</font></b>
<b><font color="#006666">EndIf</font></b>

Port = 6832

ConnectionID =<font color="#006666"> OpenNetworkConnection</font>("127.0.0.1", Port)
<b><font color="#006666">If</font></b> ConnectionID
<font color="#006666">  MessageRequester</font>("PureBasic - Client", "Client connected to server...", 0)
  
<font color="#006666">  SendNetworkString</font>(ConnectionID, "An hello from a client !!! :-)", <font color="#924B72">#PB_UTF8</font>)
    
<font color="#006666">  MessageRequester</font>("PureBasic - Client", "A string has been sent to the server, please check it before quit...", 0)
  
<font color="#006666">  CloseNetworkConnection</font>(ConnectionID)
<b><font color="#006666">Else</font></b>
<font color="#006666">  MessageRequester</font>("PureBasic - Client", "Can't find the server (Is it launched ?).", 0)
<b><font color="#006666">EndIf</font></b>
  
<b><font color="#006666">End</font></b>   </font></pre>
</body></html>
